Skip to content

Add RemoteInput#each_line - #39

Merged
kou merged 1 commit into
red-data-tools:mainfrom
tikkss:add-each-line
Nov 17, 2026
Merged

kou merged 1 commit into
red-data-tools:mainfrom
tikkss:add-each-line

Conversation

@tikkss

@tikkss tikkss commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

GitHub: GH-5

It's like IO#each_line. It passes all arguments and the block to IO#each_line.

It also returns the same value as IO#each_line does:

  • With a block: returns self, not the internal File
  • Without a block: returns an Enumerator

We need this to read a RemoteInput line by line, because Red Datasets reads some text data with IO#each_line:

RemoteInput.open("https://example.com/data.txt") do |input|
  input.each_line(chomp: true) do |line|
    # ...
  end
end

GitHub: red-data-toolsGH-5

It's like `IO#each_line`. It passes all arguments and the block to
`IO#each_line`.

It also returns the same value as `IO#each_line` does:

  * With a block: returns `self`, not the internal `File`
  * Without a block: returns an `Enumerator`

We need this to read a `RemoteInput` line by line, because Red Datasets
reads some text data with `IO#each_line`:

```ruby
RemoteInput.open("https://example.com/data.txt") do |input|
  input.each_line(chomp: true) do |line|
    # ...
  end
end
```
@kou
kou merged commit 85f95d7 into red-data-tools:main Nov 17, 2026
9 checks passed
@tikkss
tikkss deleted the add-each-line branch November 17, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants